import { GCheckBox } from "../../../../../com/mui/controls/GCheckBox";
import { Language } from "../../../../../extend/language/Language";
import { FilterConst } from "../../../../component/gconst/FilterConst";
import { GComboBox } from "../../../../../com/mui/controls/GComboBox";
import { RefreshPanelCellRender } from "./RefreshPanelCellRender";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { DataEvent } from "../../../events/DataEvent";
type int = number;
//class RefreshPanel2
    
    export  class RefreshPanel2 /* flash.display.Sprite */
    {
        constructor()
        {
            
            mouseEnabled = false;
            this._maxColorCheck = new GCheckBox();
            this._maxColorCheck.styleName = "GCheckBox";
            this._maxColorCheck.label = Language.getString(20523);
            this._maxColorCheck.width = 45;
            this._maxColorCheck.addEventListener(flash.events.Event.CHANGE, this.onMaxColorSelectedChange);
            this._maxColorCheck.textField.filters = [FilterConst.nameGlowFilter];
            addChild(this._maxColorCheck);
            this._colorComboBox = new GComboBox();
            this._colorComboBox.styleName = "GComboboxStyle";
            this._colorComboBox.drawNow();
            this._colorComboBox.dropdown.setStyle("cellRenderer", RefreshPanelCellRender);
            this._colorComboBox.dropdown.setStyle("skin", ResouceConst.getScaleBitmap(ImagesConst.WindowCenterB));
            this._colorComboBox.textField.setStyle("textFormat", new GTextFormat("", 12, 11661308, false, false, false, "", "", flash.text.TextFormatAlign.CENTER));
            this._colorComboBox.dataProvider = new DataProvider(this._colorItem);
            this._colorComboBox.x = this._maxColorCheck.width + 2;
            this._colorComboBox.selectedIndex = 4;
            this._colorComboBox.width = 60;
            this._colorComboBox.addEventListener(flash.events.Event.CHANGE, this.onColorCombChange);
            addChild(this._colorComboBox);
            this._colorComboTxt = new Object /* flash.text.TextField */();
            this._colorComboTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._colorComboTxt.textColor = 11661311;
            this._colorComboTxt.width = 20;
            this._colorComboTxt.text = Language.getString(20524);
            this._colorComboTxt.selectable = false;
            this._colorComboTxt.x = this._colorComboBox.x + this._colorComboBox.width + 2;
            this._colorComboTxt.y = 2;
            this._colorComboTxt.filters = [FilterConst.nameGlowFilter];
            addChild(this._colorComboTxt);
            this._autoBuyCheck = new GCheckBox();
            this._autoBuyCheck.styleName = "GCheckBox";
            this._autoBuyCheck.label = Language.getString(20187);
            this._autoBuyCheck.y = 23;
            this._autoBuyCheck.width = 150;
            this._autoBuyCheck.addEventListener(flash.events.Event.CHANGE, this.onAutoBuySelectedChange);
            this._autoBuyCheck.selected = true;
            this._autoBuyCheck.textField.filters = [FilterConst.nameGlowFilter];
            addChild(this._autoBuyCheck);
            return;
        }

        public updateData(): void
        {
            return;
        }

        /* internal  */onMaxColorSelectedChange(arg1: Object /* flash.events.Event */): void
        {
            return;
        }

        /* internal  */onColorCombChange(arg1: Object /* flash.events.Event */): void
        {
            return;
        }

        /* internal  */onAutoBuySelectedChange(arg1: Object /* flash.events.Event */): void
        {
            this.dispatchEvent(new DataEvent(RefreshPanel2.AutoBuySelectedChange));
            return;
        }

        public get autoBuySelected(): Boolean
        {
            return this._autoBuyCheck.selected;
        }

        public get flushColor(): int
        {
            if (!this._maxColorCheck.selected) 
            {
                return 0;
            }
            return this._colorComboBox.selectedItem.value;
        }

        protected /* const */_colorItem: Array<any>=[{"label": Language.getString(20271) + Language.getString(20396), "value": 2}, {"label": Language.getString(20272) + Language.getString(20396), "value": 3}, {"label": Language.getString(20273) + Language.getString(20396), "value": 4}, {"label": Language.getString(20274) + Language.getString(20396), "value": 5}];

        public static /* const */AutoBuySelectedChange: string="AutoBuySelectedChange_RefreshPanel2";

        protected /* var */_maxColorCheck: GCheckBox;

        protected /* var */_colorComboBox: GComboBox;

        protected /* var */_colorComboTxt: Object /* flash.text.TextField */;

        protected /* var */_autoBuyCheck: GCheckBox;
    }
